#!/bin/sh
#
# see: dh_installdeb(1)

set -e

package="ti-c6000-cgt-v8.0.x-installer"

# summary of how this script can be called:
#        * <prerm> `remove'
#        * <old-prerm> `upgrade' <new-version>
#        * <new-prerm> `failed-upgrade' <old-version>
#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
#        * <deconfigured's-prerm> `deconfigure' `in-favour'
#          <package-being-installed> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

remove_file () {
	if [ -f ${wfile} ] ; then
		rm -f ${wfile}
	fi
}

remove_dir () {
	if [ -d ${wdir} ] ; then
		rm -rf ${wdir}
	fi
}

remove_all() {
	wfile="/usr/bin/abs6x" ; remove_file
	wfile="/usr/bin/acp6x" ; remove_file
	wfile="/usr/bin/acpia6x" ; remove_file
	wfile="/usr/bin/ap6x" ; remove_file
	wfile="/usr/bin/ap6x3" ; remove_file
	wfile="/usr/bin/ar6x" ; remove_file
	wfile="/usr/bin/asm6x" ; remove_file
	wfile="/usr/bin/cbe6x" ; remove_file
	wfile="/usr/bin/cbeia6x" ; remove_file
	wfile="/usr/bin/cg6x" ; remove_file
	wfile="/usr/bin/cg6x3" ; remove_file
	wfile="/usr/bin/ci6x" ; remove_file
	wfile="/usr/bin/cl6x" ; remove_file
	wfile="/usr/bin/clist6x" ; remove_file
	wfile="/usr/bin/clt6x" ; remove_file
	wfile="/usr/bin/cmp6x" ; remove_file
	wfile="/usr/bin/dem6x" ; remove_file
	wfile="/usr/bin/dis6x" ; remove_file
	wfile="/usr/bin/embed6x" ; remove_file
	wfile="/usr/bin/hex6x" ; remove_file
	wfile="/usr/bin/ilk6x" ; remove_file
	wfile="/usr/bin/libinfo6x" ; remove_file
	wfile="/usr/bin/llp6x" ; remove_file
	wfile="/usr/bin/lnk6x" ; remove_file
	wfile="/usr/bin/mk6x" ; remove_file
	wfile="/usr/bin/nm6x" ; remove_file
	wfile="/usr/bin/ofd6x" ; remove_file
	wfile="/usr/bin/omps2s6x" ; remove_file
	wfile="/usr/bin/opt6x" ; remove_file
	wfile="/usr/bin/pdd6x" ; remove_file
	wfile="/usr/bin/pprof6x" ; remove_file
	wfile="/usr/bin/prelink6x" ; remove_file
	wfile="/usr/bin/strip6x" ; remove_file
	wfile="/usr/bin/xref6x" ; remove_file

	wdir="/usr/share/doc/ti/cgt-c6x/" ; remove_dir

	wfile="/usr/share/man/man1/abs6x.1" ; remove_file
	wfile="/usr/share/man/man1/acp6x.1" ; remove_file
	wfile="/usr/share/man/man1/acpia6x.1" ; remove_file
	wfile="/usr/share/man/man1/ap6x.1" ; remove_file
	wfile="/usr/share/man/man1/ap6x3.1" ; remove_file
	wfile="/usr/share/man/man1/asm6x.1" ; remove_file
	wfile="/usr/share/man/man1/cbe6x.1" ; remove_file
	wfile="/usr/share/man/man1/cbeia6x.1" ; remove_file
	wfile="/usr/share/man/man1/cg6x.1" ; remove_file
	wfile="/usr/share/man/man1/cg6x3.1" ; remove_file
	wfile="/usr/share/man/man1/ci6x.1" ; remove_file
	wfile="/usr/share/man/man1/cl6x.1" ; remove_file
	wfile="/usr/share/man/man1/clt6x.1" ; remove_file
	wfile="/usr/share/man/man1/dem6x.1" ; remove_file
	wfile="/usr/share/man/man1/dis6x.1" ; remove_file
	wfile="/usr/share/man/man1/embed6x.1" ; remove_file
	wfile="/usr/share/man/man1/hex6x.1" ; remove_file
	wfile="/usr/share/man/man1/ilk6x.1" ; remove_file
	wfile="/usr/share/man/man1/libinfo6x.1" ; remove_file
	wfile="/usr/share/man/man1/lnk6x.1" ; remove_file
	wfile="/usr/share/man/man1/nm6x.1" ; remove_file
	wfile="/usr/share/man/man1/ofd6x.1" ; remove_file
	wfile="/usr/share/man/man1/omps2s6x.1" ; remove_file
	wfile="/usr/share/man/man1/opt6x.1" ; remove_file
	wfile="/usr/share/man/man1/pdd6x.1" ; remove_file
	wfile="/usr/share/man/man1/pprof6x.1" ; remove_file
	wfile="/usr/share/man/man1/prelink6x.1" ; remove_file
	wfile="/usr/share/man/man1/strip6x.1" ; remove_file
	wfile="/usr/share/man/man1/xref6x.1" ; remove_file

	wdir="/usr/share/ti/cgt-c6x/" ; remove_dir

	wfile="/var/cache/${package}/ti_cgt_c6000_8.0.0_armlinuxa8hf_busybox_installer.sh" ; remove_file
	wfile="/var/cache/${package}/ti_cgt_c6000_8.0.1_armlinuxa8hf_busybox_installer.sh" ; remove_file
	wfile="/var/cache/${package}/ti_cgt_c6000_8.0.2_armlinuxa8hf_busybox_installer.sh" ; remove_file
	wfile="/var/cache/${package}/ti_cgt_c6000_8.0.3_armlinuxa8hf_busybox_installer.sh" ; remove_file
	#wfile="/var/cache/${package}/ti_cgt_c6000_8.0.4_armlinuxa8hf_busybox_installer.sh" ; remove_file
}

case "$1" in
    remove|upgrade|deconfigure)
	remove_all
    ;;

    failed-upgrade)
    ;;

    *)
        echo "prerm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0


